#include "GScene.h"
#include "GModel.h"
#include "GMaterial.h"
#include "phong_shader.h"
#include "pbr_shader.h"
#include "GTexture.h"

GScene* generate_test_scene()
{
	GScene* pBaseScene = new GScene();
	const char* pszPath = "obj/xier/";
	pBaseScene->LoadModel1(pszPath, "xierface.obj", "xierface_diffuse.tga");
	pBaseScene->LoadModel1(pszPath, "xierhair.obj", "xierhair_diffuse.tga");
	pBaseScene->LoadModel1(pszPath, "xierarm.obj", "xierarm_diffuse.tga");
	pBaseScene->LoadModel1(pszPath, "xierbody.obj", "xierbody_diffuse.tga");
	pBaseScene->LoadModel1(pszPath, "xiercloth.obj", "xiercloth_diffuse.tga");
	return pBaseScene;
}

GScene* generate_zhongli_scene()
{
	GScene* pBaseScene = new GScene();
	const char* pszPath = "obj/zhongli/";
	pBaseScene->LoadModel1(pszPath, "zhongli.obj", "xierface_diffuse.tga");
	return pBaseScene;
}

GScene::GScene()
{
	
}

GModel* GScene::LoadModel1(const char* pszPath, const char* _szObjName, const char* _szDiffuseTex)
{
	std::string szModelPath = std::string(pszPath) + std::string(_szObjName);
	std::string szDiffuseTex = std::string(pszPath) + std::string(_szDiffuseTex);
	GModel* pModel = new GModel();
	pModel->LoadObj(szModelPath);
	GMaterial* pMat = new GMaterial();
	GTexture* pTex = new GTexture();
	pTex->LoadTgaTex(szDiffuseTex.c_str());
	pMat->m_pShader = new PBRShader();
	pMat->m_pMainTex = pTex;
	pModel->m_pMaterial = pMat;
	m_lstModel.push_back(pModel);
	return pModel;
}